#ifndef SCENE_MAIN_H
#define SCENE_MAIN_H

#include "core/scene.h"
#include "raw/timer.h"
#include "screen/hud_button.h"

class Player;
class Spawner;
class UIMouse;
class HUDStats;
class HUDText;

class SceneMain : public Scene {
private:
    void rendererBackground(); // 渲染背景
    Player *player_ = nullptr; // 玩家
    Spawner *spawner_ = nullptr;
    UIMouse *ui_mouse_ = nullptr;
    HUDStats *hud_stats_ = nullptr;
    HUDText *hud_text_ = nullptr;
    HUDButton *button_pause_ = nullptr;
    HUDButton *button_back_ = nullptr;
    HUDButton *button_restart_ = nullptr;
    Timer *end_timer_ = nullptr;

public:
    SceneMain() = default;

    ~SceneMain() override = default;

    /**
     * 初始化场景
     */
    void init() override;

    /**
     * 更新场景
     */
    void update(float dt) override;

    /**
     * 渲染场景
     */
    void render() override;

    /**
     * 清理场景
     */
    void clean() override;

    /**
     * 处理事件
     */
    bool handleEvents(SDL_Event &event) override;

    void updateScore();

    void checkButtonPause();

    void checkButtonBack();

    void checkButtonRestart();

    void checkEndTimer();

    void saveData(const std::string &file_path) override;
    void checkSlowDown(float& dt);
};
#endif // SCENE_MAIN_H
